<?php

/**
 * DecReservacion filter form base class.
 *
 * @package    PhpProject1
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseDecReservacionFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'res_persona_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecPersona'), 'add_empty' => true)),
      'res_promocion'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecPromocion'), 'add_empty' => true)),
      'res_fecha_entrada'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'res_fecha_salida'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'res_numero_adultos' => new sfWidgetFormFilterInput(),
      'res_numero_ninos'   => new sfWidgetFormFilterInput(),
      'res_estado'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'RESERVADO' => 'RESERVADO', 'CONFIRMADO' => 'CONFIRMADO', 'CANCELADO' => 'CANCELADO', 'FINALIZADO' => 'FINALIZADO'))),
    ));

    $this->setValidators(array(
      'res_persona_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('DecPersona'), 'column' => 'per_id')),
      'res_promocion'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('DecPromocion'), 'column' => 'pro_id')),
      'res_fecha_entrada'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'res_fecha_salida'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'res_numero_adultos' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'res_numero_ninos'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'res_estado'         => new sfValidatorChoice(array('required' => false, 'choices' => array('RESERVADO' => 'RESERVADO', 'CONFIRMADO' => 'CONFIRMADO', 'CANCELADO' => 'CANCELADO', 'FINALIZADO' => 'FINALIZADO'))),
    ));

    $this->widgetSchema->setNameFormat('dec_reservacion_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DecReservacion';
  }

  public function getFields()
  {
    return array(
      'res_id'             => 'Number',
      'res_persona_id'     => 'ForeignKey',
      'res_promocion'      => 'ForeignKey',
      'res_fecha_entrada'  => 'Date',
      'res_fecha_salida'   => 'Date',
      'res_numero_adultos' => 'Number',
      'res_numero_ninos'   => 'Number',
      'res_estado'         => 'Enum',
    );
  }
}
